/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entidades;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author lomanda
 */
@Entity
@Table(name = "classeConta")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ClasseConta.findAll", query = "SELECT c FROM ClasseConta c"),
    @NamedQuery(name = "ClasseConta.findByIdClasse", query = "SELECT c FROM ClasseConta c WHERE c.idClasse = :idClasse"),
    @NamedQuery(name = "ClasseConta.findByDescricao", query = "SELECT c FROM ClasseConta c WHERE c.descricao = :descricao")})
public class ClasseConta implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "idClasse")
    private Integer idClasse;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "descricao")
    private String descricao;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "fkClasse")
    private List<Contas> contasList;

    public ClasseConta() {
    }

    public ClasseConta(Integer idClasse) {
        this.idClasse = idClasse;
    }

    public ClasseConta(Integer idClasse, String descricao) {
        this.idClasse = idClasse;
        this.descricao = descricao;
    }

    public Integer getIdClasse() {
        return idClasse;
    }

    public void setIdClasse(Integer idClasse) {
        this.idClasse = idClasse;
    }

    public String getDescricao() {
        return descricao;
    }

    public void setDescricao(String descricao) {
        this.descricao = descricao;
    }

    @XmlTransient
    public List<Contas> getContasList() {
        return contasList;
    }

    public void setContasList(List<Contas> contasList) {
        this.contasList = contasList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idClasse != null ? idClasse.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ClasseConta)) {
            return false;
        }
        ClasseConta other = (ClasseConta) object;
        if ((this.idClasse == null && other.idClasse != null) || (this.idClasse != null && !this.idClasse.equals(other.idClasse))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidades.ClasseConta[ idClasse=" + idClasse + " ]";
    }
    
}
